package person.wend.mybatisexample.plugin.achieve;


import person.wend.mybatisexample.plugin.realize.Interceptor;
import person.wend.mybatisexample.plugin.realize.Intercepts;
import person.wend.mybatisexample.plugin.realize.Invocation;
import person.wend.mybatisexample.plugin.realize.Signature;
import person.wend.mybatisexample.plugin.target.TestComponent;

// ExamplePlugin.java
@Intercepts({@Signature(
        type= TestComponent.class,
        method = "test",
        args = {String.class})})
public class Interceptor1 implements Interceptor {
    @Override
    public Object intercept(Invocation invocation) throws Throwable {
        // implement pre processing if need
        System.out.println("Interceptor1 pre process");
        Object returnObject = invocation.proceed();
        System.out.println("Interceptor1 post process");
        // implement post processing if need
        return returnObject;
    }
}
